package com.panda.controller.video;

import com.panda.service.VideoService;
import com.panda.utils.RespondResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("backstage/video")
public class VideoController {

    @Autowired
    private VideoService videoService;

    @GetMapping("createdVideoOfWeek")
    public RespondResult createdVideoStatistic(){
        return videoService.createdVideoStatistic();
    }

    @GetMapping("categoryCount")
    public RespondResult videoStatistic(){
        return videoService.categoryStatistic();
    }

    @GetMapping("categoryCountOfWeek")
    public RespondResult createdCategoryOfVideoStatistic(@RequestParam String categoryName){
//        FIXME 后期优化：加一个类目是否存在的判断
        return videoService.createdCategoryOfVideoStatistic(categoryName);
    }
}
